import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '/main',
    name: 'Main',
    component: () => import('@/views/main/index.vue'),
    children: [
      {
        path: '/home',
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: { title: '题库' }
      },
      {
        path: '/statics',
        name: 'Statics',
        component: () => import('@/views/statics/index.vue'),
        meta: { title: '数据统计' }
      },
      {
        path: '/examination',
        name: 'examination',
        component: () => import('@/views/examination/index.vue'),
        meta: { title: '软考' }
      }
    ]
  }
]
const router = createRouter({
  history: createWebHistory(),
  routes
})

router.beforeEach((form, to, next) => {
  next()
})
export default router
